const Constract = artifacts.require('MinminToken.sol');

module.exports = async function(callback) {
  const constract = await Constract.deployed()
  const accounts = await web3.eth.getAccounts()

  // test script...
  let res = await constract.balanceOf(accounts[0])
  console.log(fromWei(res, 'ether'))

  await constract.transfer(accounts[1], toWei(1000), {
    from: accounts[0]
  })

  let res1 = await constract.balanceOf(accounts[0])
  console.log(fromWei(res1, 'ether'));

  let res2 = await constract.balanceOf(accounts[1])
  console.log(fromWei(res2, 'ether'));

  callback()
}

function fromWei(val) {
  return web3.utils.fromWei(val, 'ether')
}

function toWei(val) {
  return web3.utils.toWei(val.toString(), 'ether')
}